package main

import (
	"fmt"
	"gatewayConsumer/configs"
	"gatewayConsumer/redishelper"
	log "github.com/sirupsen/logrus"
	"os"
	"time"
)

func init() {
	initLog()
}
func main() {

	fmt.Println("开始解析")
	cfg := configs.GetConfig()
	fmt.Println(cfg.Version)
	fmt.Println(cfg.Redis.Host)
	fmt.Println(cfg.Redis.PreKey)

	fmt.Println("结束解析")
	redishelper.Rdb()

	gatewayResult := redishelper.GetGatewayCache()
	log.Infof(gatewayResult)
	time.Sleep(time.Duration(2) * time.Second)
	tagResult := redishelper.GetTagCache()
	log.Infof(tagResult)
}

func initLog() {
	// Log as JSON instead of the default ASCII formatter.
	log.SetFormatter(&log.JSONFormatter{})

	// Output to stdout instead of the default stderr
	// Can be any io.Writer, see below for File example
	log.SetOutput(os.Stdout)

	// Only log the warning severity or above.
	log.SetLevel(log.InfoLevel)
}
